package chapter04;

public class Test07_exceptionClass {
    public static void main(String[] args) {
        try{
            divide(10,-10);
        }catch (Exception e){
            System.out.println(e.getMessage());
        }
    }
    public static int divide(int a,int b) throws Exception{
        if(b<0){
            throw new DivideMinus("负数不能做除数");
        }else {
            return a/b;
        }
    }
}
class DivideMinus extends Exception{
    public DivideMinus() {
        super();
    }
    public DivideMinus(String message) {
        super(message);
    }
}
